{include file="common/head"}   
<link    rel="stylesheet"    href="https://cdnjs.cloudflare.com/ajax/libs/jodit/3.24.2/jodit.es2018.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jodit/3.24.2/jodit.es2018.min.js"></script>    
<style>
.form-control{width: initial;display: inline-block;}
</style>
</head>
<body >
<div class="container-fluid">

    <form action="/index.php/question/index" method="post">
    <div class="row" id="query_bar" style="height: 50px;line-height: 50px;">
        <div class="col">
        <label for="model" >驾照类型：</label>
        <select name="model" class="form-control" style="width:140px;display:initial;">
            <option value="">所有</option>
            <option value="C1" {if $model=="C1"} selected{/if} >C1</option>
            <option value="C2" {if $model=="C2"} selected{/if} >C2</option>
            <option value="D,E,F" {if $model=="D,E,F"} selected{/if} >D,E,F</option>
            <option value="SL" {if $model=="SL"} selected{/if} >三力测试</option>
        </select>

        <label for="subject" >科目：</label>
        <select name="subject" class="form-control" style="width:140px;display:initial;">
            <option value="">所有</option>
            <option value="1" {if $subject==1} selected{/if} >科目一</option>
            <option value="4" {if $subject==4} selected{/if} >科目四</option>
        </select>

        <label for="type" >题目类型：</label>
        <select name="type" class="form-control" style="width:140px;display:initial;">
            <option value="">所有</option>
            <option value="1" {if $type==1} selected{/if} >单选题</option>
            <option value="2" {if $type==2} selected{/if} >多选题</option>
            <option value="3" {if $type==3} selected{/if} >判断题</option>
        </select>


        <label for="title" >关键字：
            <input class="form-control" type="text" value="{$title}" id="title" name="title" placeholder="名称关键字" />
        </label>
        
        <button type="button" class="btn btn-warning query" style="vertical-align: middle;" >
            <span class="bi-search" ></span>
        </button>

            </div>

    </div>
    </form>

    <h2>考题维护</h2>
    <table class="table table-sm table-hover table-striped" style="width: 100%;">
        <thead style="">
            <th>序号</th>
            <th>驾照类型</th>
            <th>科目</th>            
            <th>题目</th>
            <th>选项</th>  
            <th>类型</th>                      
            <th>答案</th> 
            <th>考题分析</th>
            <th>考题图片</th>
            <th>状态</th>
            <th><a href="/index.php/question/question_add" alt="新增考题" style="color:white;">
                <button type="button" class="btn btn-primary" >
                    <span class="bi-plus-lg"></span>
                </button>
                </a>                
            </th>
        </thead>
        <tbody>
            {foreach $list['data'] as $k=>$kv}
            <tr>
                <td>{$k+1}</td>
                <td>{$kv['model']}</td>
                <td>科目{$kv['subject']}</td>
                <td class="long_field">{$kv['title']}</td>
                <td class="long_field" style="max-width: 500px;">{$kv['options']}</td>
                <td>{$kv['type_name']}</td>                
                <td >{$kv['answer']}</td>
                <td class="long_field">{$kv['desc']}</td>
                <td><img class="goods_image" src="{$kv['image']}" style="width:60px;border:1px solid #ccc;" /></td>
                {if $kv['status']==1}
                    <td>{$kv['status_name']}</td>
                {else if $kv['status']==2}
                    <td style="text-decoration:line-through;color:red;">{$kv['status_name']}</td>
                {/if}
                <td>
                    <a href="/index.php/question/edit/id/{$kv['id']}">
                        <button tyle="button" class="btn btn-sm btn-info"><span class="bi-pencil"></span></button>
                    </a>
                </td>
            </tr>
            {/foreach}
        
        </tbody>    
    </table>
    {include file="common/pagination"}
     
</div>

</body>

<script type="text/javascript">
  $(document).ready(function(){    
    //显示图片

    $("#commision_save").on('click',function(){
        var val = $("#commision").val();
        if(isNaN(val) || val<0.05 || val>0.5 ){
            layer.msg('佣金设置不正确,请设置0.05-0.5(5%-50%)');
            return false;
        }
        $.post('/goods/commision_set',{commision:val},function(res){
            console.log(res.code)
            layer.msg(res.msg);
        })

    });

    $(".query").on('click',function(){
        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
        var cid = $("#customer_id").val();
        var order_no = $("#order_no").val();
        var sdate = $("#sdate").val();
        var edate = $("#edate").val();

        $("form").submit();
        layer.close(index);
    })

    $(".goods_image").on('click',function(){
        var img = $(this).attr('src');
        if(!img.trim()) return;

        layer.open({
          type: 1,
          title:'',
          closeBtn: 0, //不显示关闭按钮
         // anim: 1,
          time: 5*1000,
          shadeClose: true, //开启遮罩关闭              
          skin: 'layui-layer-rim', 
          content: "<img src='"+img+"' style='width:100%'>"
        });
    })
})
</script>


</body>
</html>
